import {INCREMENT,DECREMENT} from   "../constens/countConst"



const init={
    count:0
}

export const countReducer=(prevState=init,action)=>{
    const{
        type,
        data
    }=action
    switch(type){
        case INCREMENT :
        return   {...init,count:prevState.count+data}
        case DECREMENT:
            return {...init,count:prevState.count-data}
    }

return prevState
}